﻿
using System.Collections.Generic;

namespace Test30.Engine
{
    public class Warrior : HeroClass
    {
        public readonly SortedDictionary<string, int> Slays = new SortedDictionary<string, int>();
        public IEnumerable<SlayLore> SlayLore
        {
            get
            {
                foreach (var pair in Slays)
                {
                    yield return new SlayLore(pair.Key, pair.Value, GetLevel(pair.Value));
                }
            }
        }

        private int GetLevel(int count)
        {
            int level = 0;
            int step = 10;

            while ((count >= step) && (level <= MaxLevel))
            {
                level++;
                count -= step;
                step += 10;
            }

            return level;
        }
        private const int MaxLevel = 10;
    }
    public class SlayLore
    {
        public string Group { get; }
        public int Slain { get; }
        public int Level { get; }

        public SlayLore(string group, int slain, int level)
        {
            Group = group;
            Slain = slain;
            Level = level;
        }
    }
}
